/**
 * Created by Administrator on 2016/1/29.
 */

var crypto = require("crypto");
var math = require("math");
exports.title = '全栈专家平台';
//检测cookie
exports.checkLogin = function(req){
    var user = false;
    if (req.cookies.loginuid){
        var user = {
            "loginname":req.cookies.loginname,
            "loginuid":req.cookies.loginuid
        }
    }
    return user;
};
//加严
exports.md5 = function(str){
    var md5 = crypto.createHash('md5');
    md5.update(str);
    return md5.digest('hex');
};
exports.setSalt = function(){
    return parseInt(math.random()*90000000 + 10000000);
};
exports.getSignPassword = function(password,salt){
    return this.md5(password + "dfsdfsd" + salt);
}